import asyncio


async def print1():
    while True:
        print(1)
        await asyncio.sleep_ms(500)


async def print2():
    while True:
        print(2)
        await asyncio.sleep_ms(500)


loop = asyncio.get_event_loop()
all_groups = asyncio.gather(print1(), print2())
results = loop.run_until_complete(all_groups)
